<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <basic-input 
        :value="username" 
        @input="handleInput($event.target.value)"></basic-input>
      <p>{{username}}</p>
    </div>
    <script src="vue.js"></script>
    <script src="vue-router.js"></script>
    <script>
      Vue.component('basic-input',{
        props:['value'],
        template:`
        <label>
          <input
            :value="value"
            v-on="$listeners"
          />
        </label>`,
        created(){
          console.log('$listeners',this.$listeners)
        }
      });
      var vm = new Vue({
        el:'#app',
        data(){return {username:'zhangsan'}},
        methods:{
          handleInput(value){
            this.username = value;
          }
        }
      });
    </script>
  </body>
</html>
